package com.line.myprojectservice.controller;

import com.line.myprojectservice.utils.ResponseUtil;
import com.line.myprojectservice.vo.DepartmentInfoVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

import static com.line.myprojectservice.chatserver.service.PublicService.*;

@RestController
@RequestMapping("/appointmentInfo")
public class AppointmentInfoController {

    @GetMapping()
    public ResponseUtil getDepartmentInfo() {

        initDepartment();
        List<DepartmentInfoVo> departmentInfoVos = new ArrayList<>();

        //lamda表达式组装
        doctorsMap.keySet().forEach(o ->
                departmentInfoVos.add(
                        new DepartmentInfoVo(o, doctorsMap.get(o).size(), patientsMap.get(o).size())));

        return ResponseUtil.success(departmentInfoVos);
    }


}
